/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Proxy;

import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;

/**
 *
 * @author Andreea
 */
/*restricted user will have acces only to normal tags
 tags marked with <secret> and <top-secret> won't be seen by this type of user
*/
public class RestrictedUser implements FileInterface{
    private MyFile file;
    @Override
    
    public String showInfo() {
            while(file.getContent().contains("<secret>")){
                int start=file.getContent().indexOf("<secret>");
                int end=file.getContent().indexOf("</secret>");
                file.setContent(file.getContent().substring(0,start)+file.getContent().substring(end+9,file.getContent().length()));
            }
            while(file.getContent().contains("<top-secret>")){
                int start=file.getContent().indexOf("<top-secret>");
                int end=file.getContent().indexOf("</top-secret>");
                file.setContent(file.getContent().substring(0,start)+file.getContent().substring(end+13,file.getContent().length()));
            }      
            return file.getContent();
    }

    public RestrictedUser(MyFile file) {
        this.file = file;
    }

    public MyFile getFile() {
        return file;
    }

    public void setFile(MyFile file) {
        this.file = file;
    }
}
